home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Best of MacTutor - S…e Code for Volumes 1 to 5
/
The Best of MacTutor - Source Code for Volume 1-5 (Wayzata Technology)(6031)(1990).bin
/
Source Code
/
#06 (Feb 86)
/
pascal 2.2
/
Play_Clip_Wave
< prev
next >
Wrap
Text File
|
1985-12-20
|
1KB
|
58 lines
program Play_Clip_Wave;
type
Ptr = ^integer;
ParamBlockFake = array[0..30] of integer;
MySynthH = ^MySynthP;
MySynthP = ^FFSynthRec;
var
waveH : MySynthH;
TheType, offset, Size : Longint;
str : str255;
blockA, blockB : ParamBlockFake;
AUsed : boolean;
procedure MyStartSound (SynthRec : ptr;
numbytes : longint;
CompletionRtn : Ptr);
var
regs : array[0..12] of longint; { for generic }
BlockPtr : ^ParamBlockFake;
begin
if Aused then
BlockPtr := @BlockA
else
BlockPtr := @BlockB;
Aused := not Aused;
BlockPtr^[12] := -4;{ set ioRefNum }
BlockMove(@SynthRec, @BlockPtr^[16], 4);{ ioBuffer }
BlockMove(@numbytes, @BlockPtr^[18], 4);{ ioReqCount }
while BlockPtr^[8] <> 0 do { wait for ioResult }
;
{ The following two lines perform PBWrite(BlockPtr,true) }
regs[0] := ord(BlockPtr);{ set A0 for generic }
Generic($A403, regs);{ Write,async }
end;
begin
ShowText;
waveH := NewHandle(12);
str := 'WAVE';
BlockMove(@str[1], @TheType, 4);{ TheType:='WAVE' }
size := LinlineF($A9FD, waveH, TheType, @offset);{ GetScrap }
if size > 0 then
begin
repeat
MyStartSound(waveH^, size - 6, nil);
until button;
StopSound;
end
else
writeln('no scrap of type ''WAVE'' is available');
end.